<%@ page contentType="text/html; charset=UTF-8" %>




<form id="gu_role_up_form" name="gu_role_up_form"  class="cmxform" method="POST">
<div class="ui-title re_ui-corner-top re_ui-helper-clearfix">个人管理->修改个人信息</div>
<div class="tableBox">
<div class="contentbox">

<div class="scroll" style="height:400px; overflow-y:auto">
<div id="userx_update_errmsg"></div>

<!-- 基本信息 -->
<fieldset>
	<legend>基本信息</legend>
    <table width="100%" align="center" border="0" cellspacing="0" cellpadding="0" class="jkt-tableStyle">
    
	 <tr>
        <td class="bluetd" align="right">账号：</td>
        <td class="bluetd2">
          <input id="userx_namex_up" name="userx_namex_up" disabled />
          <input  type="hidden"  id="userx_name_up" name="userx_name_up" />
        </td>
        <td class="bluetd" align="right">真实姓名：</td>
        <td class="bluetd2" align="left">
          <input id="userx_realname_up" name="userx_realname_up"/><span class="red-color">*</span>
        </td>
        <td class="bluetd" align="right">电子邮件：</td>
        <td class="bluetd2" align="left">
          <input id="userx_email_up" name="userx_email_up"/>
        </td>
     </tr>
	 <tr>
	  <td class="bluetd" align="right">手机号码：</td>
        <td class="bluetd2" align="left">
          <input id="userx_mobiletel1_up" name="userx_mobiletel1_up"/><span class="red-color">*</span>
        </td>
	 <td class="bluetd" align="right">工作电话：</td>
        <td class="bluetd2" align="left">
          <input id="userx_worktel_up" name="userx_worktel_up"/>
        </td>
         <td class="bluetd" align="right">所属机构：</td>
         <td class="bluetd2" align="left">
          <input id="userx_companyName_up" name="userx_companyName_up" disabled />
          <input  type="hidden"  id="userx_company_up" name="userx_companyName_up" />
          <input  type="hidden"  id="userx_id_up" name="userx_id_up" />
         </td>
     </table>
</fieldset>    
<!-- 其它信息 -->     
     
<fieldset>
	<legend>其它信息</legend>
        <table width="100%" align="center" border="0" cellspacing="0" cellpadding="0" class="jkt-tableStyle">
	 
	<tr>
        <td class="bluetd" align="right">性别：</td>
        <td class="bluetd2" align="left">
          <select style="width:140px" id="userx_sex_up" name="userx_sex_up">
          <option value="-1">-选择性别-</option>
          <option value="男">男</option>
          <option value="女">女</option>
        </select>
        </td>
        
         <td class="bluetd" align="right">备用手机号：</td>
        <td class="bluetd2" align="left">
          <input id="userx_mobiletel2_up" name="userx_mobiletel2_up"/>
        </td>
        
        <td class="bluetd" align="right">传真：</td>
        <td class="bluetd2" align="left">
          <input id="userx_fax_up" name="userx_fax_up"/>
        </td>
     </tr>
     
	<tr>
       
        <td class="bluetd" align="right">生日：</td>
        <td class="bluetd2" align="left">
          <input id="userx_birthday_up_string" name="userx_birthday_up_string"/>
        </td>
        <td class="bluetd" align="right">家庭住址：</td>
        <td class="bluetd2" align="left">
          <input id="userx_address_up" name="userx_address_up"/>
        </td>
        
        <td class="bluetd" align="right">邮编：</td>
        <td class="bluetd2" align="left">
          <input id="userx_postalcode_up" name="userx_postalcode_up"/>
        </td>
        
     </tr>
	<tr> 
        
     </tr>
	<tr>
        <td class="bluetd" align="right">身份证：</td>
        <td class="bluetd2" align="left">
          <input id="userx_idcard_up" name="userx_idcard_up"/>
        </td>
        <td class="bluetd" align="right">状态：</td>
        <td class="bluetd2" align="left">
          <input id="userx_blocked_up" name="userx_blocked_up" disabled />
        </td>
         <td class="bluetd" align="right">开通时间：</td>
        <td class="bluetd2" align="left">
          <input id="userx_regdateString_up"  style="width:180px"  name="userx_regdateString_up" disabled />
        </td>
     </tr>
   
	
</table>
</fieldset>    
<div style="text-align:center">          
<input type="button" class="btns" id="userx_update_bt" value="修  改" style="margin-top:8px;" />&nbsp;&nbsp;
          <input type="button" class="btns" id="userx_reset_bt" value="重  置" style="margin-top:8px;" />&nbsp;&nbsp;
          </div>

</div>
</div>
</div>

</form>
<script>
 
     var userxdata={};//本页变量 
     userxdata.upvalidate;  
     userxdata.upval=false;

    $(function() {
        $.ajax({
            type: "POST",
            url:"system/User/getUserInfo.do",
            dataType: "json",
            contentType: "application/x-www-form-urlencoded; charset=UTF-8",
            success:function(json){
               var rowData = json.msg;
                 $("#userx_id_up").val(rowData.id);
                 $("#userx_namex_up").val(rowData.name);
		         $("#userx_password_up").val(rowData.password);
		         $("#userx_realname_up").val(rowData.realname);
		         $("#userx_sex_up").val(rowData.sex);
		         $("#userx_citySel_up").val(rowData.companyName);
		         $("#userx_company_up").val(rowData.company);
		         $("#userx_worktel_up").val(rowData.worktel);
		         $("#userx_mobiletel1_up").val(rowData.mobiletel1);
		         $("#userx_mobiletel2_up").val(rowData.mobiletel2);
		         $("#userx_fax_up").val(rowData.fax);
		         $("#userx_birthday_up_string").val(rowData.birthdayString);
		         $("#userx_email_up").val(rowData.email);
		         $("#userx_address_up").val(rowData.address);
		         $("#userx_postalcode_up").val(rowData.postalcode);
		         $("#userx_idcard_up").val(rowData.idcard);
		         if(rowData.blocked=="1"){
	                 $("#userx_blocked_up").val("正常");
		         }else if(rowData.blocked=="2"){
		             $("#userx_blocked_up").val("开通");
		         }else if(rowData.blocked=="4"){
		             $("#userx_blocked_up").val("暂停");
		         }else{
		             $("#userx_blocked_up").val("无效");
		         }
		         $("#userx_regdateString_up").val(rowData.regdateString);
		       
            }
     })

    $("#userx_birthday_up_string").datepicker()


   })


     $('#userx_update_bt').click(function(){//点击按妞
         if(rulesByValidator(userxdata.upvalidate)){
             userx_update_submit();
         }
     })
     
    $('#userx_update_close').click(function(){//关闭
         //$("#user_dialog_up").dialog('close');
     })
 
     	userxdata.upvalidate = $("#gu_role_up_form").validate({//验证
	        errorElement: "div",
            errorPlacement: function(error, element) {
			    $('#userx_update_errmsg').html("");
				error.appendTo( "#userx_update_errmsg" );
				if($.browser.mozilla){//火狐
                    $("#userx_dialog_up").dialog('option' , 'height',[400+40]);
	            }else{//其它
		            $("#userx_dialog_up").dialog('option' , 'height',[400+50]);
	            }
	            userxdata.upval=true;
			},
			success: function(label) {
			    label.text("验证通过!").removeClass("error").addClass("success");
			    userxdata.upval=true;
			},
	        rules: {
               userx_realname_up:{
                   required: true
               },
               userx_mobiletel1_up:{
                   required: true,
                   isMobile: true
               }
	        }, 
	        messages: {
                userx_realname_up:{
                    required: "真实姓名不能为空"
                },
                userx_mobiletel1_up:{
                    required: "手机号码不能为空",
                    isMobile: "请输入正确的手机号码"
                }
	        },
	        onkeyup:false,
		    onsubmit:false
	})
	
     
     
    function  userx_update_submit(){//修改提交
         var userxJson="{'id':'"+$('#userx_id_up').val()+"','name':'"+$('#userx_name_up').val()+"','realname':'"+$('#userx_realname_up').val()+"','sex':'"+$('#userx_sex_up').val()+"','company':'"+$('#userx_company_up').val()+"','worktel':'"+$('#userx_worktel_up').val()+"','mobiletel1':'"+$('#userx_mobiletel1_up').val()+"','mobiletel2':'"+$('#userx_mobiletel2_up').val()+"','fax':'"+$('#userx_fax_up').val()+"','birthdayString':'"+$('#userx_birthday_up_string').val()+"','email':'"+$('#userx_email_up').val()+"','upress':'"+$('#userx_upress_up').val()+"','postalcode':'"+$('#userx_postalcode_up').val()+"','idcard':'"+$('#userx_idcard_up').val()+"'}";  
         $.ajax({
             type: "POST",
             url:"system/User/personal.do",
             data:{
                 userJson:userxJson
             },
             dataType: "json",
             contentType: "application/x-www-form-urlencoded; charset=UTF-8",
             success:function(json){
                 if(json.success){
                     $("#userx_grid").trigger("reloadGrid");
                     alertmsg(json.msg,"info");
                 }else{
                     alertmsg(json.msg,"alert");
                 }
                 //关闭当前窗口
                 //colseTab();
             }
        })
     }
     
    $('#userx_reset_bt').click(function() {
        $.ajax({
            type: "POST",
            url:"system/User/getUserInfo.do",
            dataType: "json",
            contentType: "application/x-www-form-urlencoded; charset=UTF-8",
            success:function(json){
               var rowData = json.msg;
                 $("#userx_id_up").val(rowData.id);
                 $("#userx_namex_up").val(rowData.name);
		         $("#userx_password_up").val(rowData.password);
		         $("#userx_realname_up").val(rowData.realname);
		         $("#userx_sex_up").val(rowData.sex);
		         $("#userx_citySel_up").val(rowData.companyName);
		         $("#userx_company_up").val(rowData.company);
		         $("#userx_worktel_up").val(rowData.worktel);
		         $("#userx_mobiletel1_up").val(rowData.mobiletel1);
		         $("#userx_mobiletel2_up").val(rowData.mobiletel2);
		         $("#userx_fax_up").val(rowData.fax);
		         $("#userx_birthday_up_string").val(rowData.birthdayString);
		         $("#userx_email_up").val(rowData.email);
		         $("#userx_address_up").val(rowData.address);
		         $("#userx_postalcode_up").val(rowData.postalcode);
		         $("#userx_idcard_up").val(rowData.idcard);
		         if(rowData.blocked=="1"){
	                 $("#userx_blocked_up").val("正常");
		         }else if(rowData.blocked=="2"){
		             $("#userx_blocked_up").val("开通");
		         }else if(rowData.blocked=="4"){
		             $("#userx_blocked_up").val("暂停");
		         }else{
		             $("#userx_blocked_up").val("无效");
		         }
		         $("#userx_regdateString_up").val(rowData.regdateString);
		       
            }
     })

    $("#userx_birthday_up_string").datepicker()


   })
 
 
     
     
     

</script>